home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / apps / 29 / pascal / antenna.pas next >
Pascal/Delphi Source File  |  1985-11-19  |  3KB  |  87 lines

  1. program antenna;
  2.  
  3. const
  4.         half_wave_dipole = 468.0;
  5.         maxlines = 60;
  6.  
  7. var
  8.         printer : text;
  9.         printer_name : string;
  10.         f1,f2,f3,f4 : real;
  11.         ft,inch : real;
  12.         raw_ft  : real;
  13.         ans : char;
  14.         pcnt,lcnt : integer;
  15.  
  16. procedure Page_header;
  17.  
  18. begin
  19.                 page(printer);
  20.                 writeln(printer,' ':70,'Page ',pcnt:4);
  21.                 write(printer,' ':15,'Antenna Calculations for a Half-Wave ');
  22.                 writeln(printer,'Dipole');
  23.                 writeln(printer);
  24.                 writeln(printer,'Starting Frequency:  ',f1:10:6,' MHZ');
  25.                 writeln(printer,'Ending   Frequency:  ',f2:10:6,' MHZ');
  26.                 writeln(printer,'Step of Calculation: ',f3:10:6,' MHZ');
  27.                 writeln(printer);
  28.                 write(printer,'        Frequency        ':25,' ':10);
  29.                 writeln(printer,'                 Length                 ':40);
  30.                 write(printer,'Megahertz      Meters    ':25,' ':10);
  31.                 writeln(printer,'Feet and Inches               Feet      ':40);
  32.                 writeln(printer);
  33.                 lcnt := 10;
  34. end;
  35.  
  36.  
  37. function half_wave(freq : real):real;
  38.  
  39. begin
  40.         half_wave := half_wave_dipole / freq;
  41. end;
  42.  
  43. procedure feet_to_feet_and_inches(feet : real; var new_feet,inches : real);
  44.  
  45. begin
  46.         new_feet := trunc(feet) * 1.0;
  47.         inches := (feet - new_feet) * 12.0;
  48. end;
  49.  
  50. begin
  51.         write('Output Device or File (e.g. LST:): ');
  52.         readln(printer_name);
  53.         rewrite(printer,printer_name);
  54.         repeat
  55.                 repeat
  56.                         write('Low End Frequency in MHZ.:  ');
  57.                         readln(f1);
  58.                         write('High End Frequency in MHZ.: ');
  59.                         readln(f2);
  60.                         write('Step in Mhz.:               ');
  61.                         readln(f3);
  62.                 until f2 >= f1;
  63.                 f4 := f1;
  64.                 pcnt := 1;
  65.                 page_header;
  66.                 repeat
  67.                         raw_ft := half_wave(f4);
  68.                         feet_to_feet_and_inches(raw_ft,ft,inch);
  69.                         writeln(printer,f4:10:6,' ':5,300.0/f4:10:6,
  70.                                 ' ':10,trunc(ft):5,' feet ',
  71.                                 inch:5:2,' inches  ',
  72.                                 ' ':5,raw_ft:10:6,' feet');
  73.                         f4 := f4 + f3;
  74.                         lcnt := lcnt + 1;
  75.                         if lcnt > maxlines then begin
  76.                                 pcnt := pcnt + 1;
  77.                                 page_header;
  78.                         end;
  79.                 until f4 > f2;
  80.                 repeat
  81.                         write('Another Run (Y/N): ');
  82.                         readln(ans);
  83.                 until ans in ['Y','N','y','n'];
  84.         until ans in ['N','n'];
  85.         close(printer);
  86. end.
  87. -----------------------------------------------------------------------------------